package com.cn.wanxi.test;

import java.util.Scanner;

public class ScannerArray {
    public static void main(String[] args) {
        /**
         * 1.键盘录入
         * 2.数组
         * 3.求最大值
         */
//        int[] arr = {0, 0, 0, 0, 0};
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入第" + (i + 1) + "个数");
            int num = scanner.nextInt();
            arr[i] = num;
        }
        System.out.println("------------------");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + ",");
        }
        int max = 0;
        for (int i = 0; i < arr.length; i++) {
            max = max > arr[i] ? max : arr[i];
        }
        System.out.println("最大值为:" + max);
    }
}
